package ma.ensao.evalmetrics.util.javaProjects;


import java.util.List;

import ma.ensao.evalmetrics.controller.CaracteristiquesManager;
import ma.ensao.evalmetrics.controller.MetriquesManager;
import ma.ensao.evalmetrics.controller.ProprieteManager;
import ma.ensao.evalmetrics.controller.ResultManager;
import ma.ensao.evalmetrics.controller.SubcaracManager;
import ma.ensao.evalmetrics.controller.metrics.Calcule;


import ma.ensao.evalmetrics.model.Caracteristiques;
import ma.ensao.evalmetrics.model.Metriques;
import ma.ensao.evalmetrics.model.Propriete;
import ma.ensao.evalmetrics.model.Result;
import ma.ensao.evalmetrics.model.Subcarac;




import com.opensymphony.xwork2.ActionSupport;
//Class d'action
@SuppressWarnings("serial")
public class Interpretation extends ActionSupport {
        private Calcule calcule = new Calcule();
        private Metriques metric;
        private MetriquesManager metriquesmanager = new MetriquesManager();
        private ProprieteManager proprietemanager = new ProprieteManager();
        private CaracteristiquesManager caracteristiques = new CaracteristiquesManager();
        private SubcaracManager subcarac = new SubcaracManager();
        private Long id;
        private Caracteristiques carac;
        private Subcarac sub;
        private Propriete propriete;

        private Result result;
        

        public Result getResult() {
                
                return result;
        }

        public void setResult(Result result) {
                this.result = result;
        }

        public ResultManager getResultmanager() {
                return resultmanager;
        }

        public void setResultmanager(ResultManager resultmanager) {
                this.resultmanager = resultmanager;
        }

        private ResultManager resultmanager;
        

        private double metric_fonct;
        private double metric_fiab;
        private double metric_util;
        private double metric_effic;
        private double metric_maint;
        private double metric_port;
        private double mark;

        private String monjava;


        public String execute() {
                return SUCCESS;
        }

        public String afficher() {
                System.out.println("afficher test");
                resultmanager = new ResultManager();
                List<Result> list = resultmanager.MesResultat(id);
                result = list.get(list.size() - 1);
                System.out.println("MY ID IM THE PRO" + result.getId());
                System.out.println("afficher test");
                setMetric(metriquesmanager.list(id).get(0));
                setMetric(calcule.calculMetrique(metric, result));
                propriete = proprietemanager.list(id).get(0);
                propriete = calcule.calculPropriete(propriete);
                sub = subcarac.list(id).get(0);
                sub = calcule.calculSubcarac(sub);
                carac = caracteristiques.list(id).get(0);
                carac = calcule.calculCaracteristiques(carac);
                metric_fonct = carac.getFonctionnalite();
                metric_fiab = carac.getReliabilite();
                metric_util = carac.getUsabilite();
                metric_effic = carac.getEfficacite();
                metric_maint = carac.getMaintenabilite();
                metric_port = carac.getPortabilite();
                
                return SUCCESS;
        }


        public String getMonjava() {
                return monjava;
        }

        public void setMonjava(String monjava) {
                this.monjava = monjava;
        }


        public Long getId() {
                return id;
        }

        public void setId(Long id) {
                this.id = id;
        }

        
        public Caracteristiques getCarac() {
                return carac;
        }

        public void setCarac(Caracteristiques carac) {
                this.carac = carac;
        }

        public Subcarac getSub() {
                return sub;
        }

        public void setSub(Subcarac sub) {
                this.sub = sub;
        }

        public double getMetric_fonct() {
                return metric_fonct;
        }

        public void setMetric_fonct(double metric_fonct) {
                this.metric_fonct = metric_fonct;
        }

        public double getMetric_fiab() {
                return metric_fiab;
        }

        public void setMetric_fiab(double metric_fiab) {
                this.metric_fiab = metric_fiab;
        }

        public double getMetric_util() {
                return metric_util;
        }

        public void setMetric_util(double metric_util) {
                this.metric_util = metric_util;
        }

        public double getMetric_effic() {
                return metric_effic;
        }

        public void setMetric_effic(double metric_effic) {
                this.metric_effic = metric_effic;
        }

        public double getMetric_maint() {
                return metric_maint;
        }

        public void setMetric_maint(double metric_maint) {
                this.metric_maint = metric_maint;
        }

        public double getMetric_port() {
                return metric_port;
        }

        public void setMetric_port(double metric_port) {
                this.metric_port = metric_port;
        }

        public Propriete getPropriete() {
                return propriete;
        }

        public void setPropriete(Propriete propriete) {
                this.propriete = propriete;
        }


        public Calcule getCalcule() {
                return calcule;
        }

        public void setCalcule(Calcule calcule) {
                this.calcule = calcule;
        }

        public Metriques getMetric() {
                return metric;
        }

        public void setMetric(Metriques metric) {
                this.metric = metric;
        }

        public MetriquesManager getMetriquesmanager() {
                return metriquesmanager;
        }

        public void setMetriquesmanager(MetriquesManager metriquesmanager) {
                this.metriquesmanager = metriquesmanager;
        }

        public ProprieteManager getProprietemanager() {
                return proprietemanager;
        }

        public void setProprietemanager(ProprieteManager proprietemanager) {
                this.proprietemanager = proprietemanager;
        }

        public CaracteristiquesManager getCaracteristiques() {
                return caracteristiques;
        }

        public void setCaracteristiques(CaracteristiquesManager caracteristiques) {
                this.caracteristiques = caracteristiques;
        }

        public SubcaracManager getSubcarac() {
                return subcarac;
        }

        public void setSubcarac(SubcaracManager subcarac) {
                this.subcarac = subcarac;
        }

}